package com.bjmashibing.system.huawei;

import com.bjmashibing.system.huawei.domain.*;
import com.bjmashibing.system.huawei.jdbc.SpringJdbcTemplate;
import com.bjmashibing.system.huawei.service.MyComp;
import com.bjmashibing.system.huawei.vivo.Messaging;
import com.bjmashibing.system.huawei.vivo.xiaomi_push;
import com.bjmashibing.system.huawei.huawei_push.push.examples.SendNotifyMessage;

import com.bjmashibing.system.huawei.huawei_push.push.messaging.HuaweiApp;
import com.bjmashibing.system.huawei.oppo.oppo_push;
import com.bjmashibing.system.huawei.vivo.vivo_push;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Classname static_var
 * @Description TODO
 * @Date 2020/9/16/016 18:04
 * @Created by Administrator
 */
public class static_var {
    private final static Logger logger = LoggerFactory.getLogger(static_var.class);
    static public long nums_push = 0;


    public static long time_recv = System.currentTimeMillis();
    public static_var() {
    }

    public static Map<String, List<Token>> map_token = new HashMap<String, List<Token>>();
    public static Map<String,Integer> map_machine = new HashMap<String, Integer>();
    public static Map<String, SocketChannel> map_socket = new HashMap<String, SocketChannel>();

    public static Map<String, List<History>> map_history = new HashMap<String, List<History>>();
    public static BufferInfo[] buffer_2 = new BufferInfo[100];

    public static String str_device_token = "";

    public static String str_110_var = "火警";
    public static String str_110_var_en = "Fire";
    public static String str_110_var_german = "Feuer";
    public static String str_110_var_russian = "Огонь";
    public static String str_110_var_french = "Alarme incendie";
    public static String str_110_var_italian = "Incendio";
    public static String str_110_var_spanish = "Fuego";
    public static String str_110_var_portuguese = "Fogo";
    public static String str_110_var_arabic = "حريق";
    public static String str_131_var = "周界报警";
    public static String str_131_var_en = "Perimeter";
    public static String str_131_var_german = "Perimeter";
    public static String str_131_var_russian = "Пермитер";
    public static String str_131_var_french = "Périmètre";
    public static String str_131_var_italian = "Perimetro";
    public static String str_131_var_spanish = "Perímetro";
    public static String str_131_var_portuguese = "Perímetro";
    public static String str_131_var_arabic = "المحيط الخارجي";
    public static String str_120_var = "Emergency";
    public static String str_120_var_en = "Emergency";
    public static String str_120_var_german = "Notfall";
    public static String str_120_var_russian = "Экстренный";
    public static String str_120_var_french = "Urgence";
    public static String str_120_var_italian = "Emergenza";
    public static String str_120_var_spanish = "Emergencia";
    public static String str_120_var_portuguese = "Emergência";
    public static String str_120_var_arabic = "طوارئ";
    public static String str_130_var = "盗警";
    public static String str_130_var_en = "Burglar";
    public static String str_130_var_german = "Einbruch";
    public static String str_130_var_russian = "Кража со взломом";
    public static String str_130_var_french = "Cambriolage";
    public static String str_130_var_italian = "Furto con scasso";
    public static String str_130_var_spanish = "Robo";
    public static String str_130_var_portuguese = "Roubo";
    public static String str_130_var_arabic = "سطو";
    public static String str_121_var = "胁迫";
    public static String str_121_var_en = "Help";
    public static String str_121_var_german = "Hilfe/SOS";
    public static String str_121_var_russian = "Помощь/SOS";
    public static String str_121_var_french = "Aide / SOS";
    public static String str_121_var_italian = "Aiuto/SOS";
    public static String str_121_var_spanish = "Ayuda/SOS";
    public static String str_121_var_portuguese = "Ajuda/SOS";
    public static String str_121_var_arabic = "مساعدة";
    public static String str_151_var = "煤气";
    public static String str_151_var_en = "Gas";
    public static String str_151_var_german = "Gas";
    public static String str_151_var_russian = "Газ";
    public static String str_151_var_french = "Gaz";
    public static String str_151_var_italian = "Fuga di gas";
    public static String str_151_var_spanish = "Gas";
    public static String str_151_var_portuguese = "Gás";
    public static String str_151_var_arabic = "غاز";
    public static String str_113_var = "水警";
    public static String str_113_var_en = "Water";
    public static String str_113_var_german = "Überschwemmung";
    public static String str_113_var_russian = "Потоп";
    public static String str_113_var_french = "Inondation";
    public static String str_113_var_italian = "Allagamento";
    public static String str_113_var_spanish = "Gas";
    public static String str_113_var_portuguese = "Largo";
    public static String str_113_var_arabic = "فيضان";
    public static String str_456_var = "探头异常";
    public static String str_456_var_en = "Detector anomaly";
    public static String str_456_var_german = "Anomalie Detektors";
    public static String str_456_var_russian = "Детектор анамалии";
    public static String str_456_var_french = "détecteur d'anomalie";
    public static String str_456_var_italian = "Rilevatore di anomalie";
    public static String str_456_var_spanish = "Anomalía del detector";
    public static String str_456_var_portuguese = "Anomalia do detector";
    public static String str_456_var_arabic = "عطل بجهاز الرصد";

    public static String str_380_var = "电源故障低电";
    public static String str_380_var_en = "Power failure (low battery)";
    public static String str_380_var_german = "Stromausfall (schwache Batterie)";
    public static String str_380_var_russian = "Сбой питания (низкий заряд батареи)";
    public static String str_380_var_french = "Panne de courant (batterie faible)";
    public static String str_380_var_italian = "Mancanza di corrente (batteria scarica)";
    public static String str_380_var_spanish = "Fallo de energía (batería baja)";
    public static String str_380_var_portuguese = "Falha de energia (bateria fraca)";
    public static String str_380_var_arabic = "عطل بالطاقة (بطارية منخفضة)";
    public static String str_384_var = "防拆";
    public static String str_384_var_en = "Tamper";
    public static String str_384_var_german = "Manipulation";
    public static String str_384_var_russian = "Искажать";
    public static String str_384_var_french = "Tamper";
    public static String str_384_var_italian = "Manomissione";
    public static String str_384_var_spanish = "Manipular";
    public static String str_384_var_portuguese = "Adulterar";
    public static String str_384_var_arabic = "تلاعب";
    public static String str_383_var = "医疗";
    public static String str_383_var_en = "Medical";
    public static String str_383_var_german = "Medizinisch";
    public static String str_383_var_russian = "Медицинский";
    public static String str_383_var_french = "Médical";
    public static String str_383_var_italian = "Medico";
    public static String str_383_var_spanish = "Médico";
    public static String str_383_var_portuguese = "Médicos";
    public static String str_383_var_arabic = "طبي";

    public static String str_1710_var = "主机恢复出厂设置";
    public static String str_1711_var = "本端消警";


    public static String str_1400_var = "撤防";
    public static String str_1400_var_en = "Disarm";
    public static String str_1400_var_german = "Entschärfen";
    public static String str_1400_var_russian = "Разоружение";
    public static String str_1400_var_french = "Désarmer";
    public static String str_1400_var_italian = "Disarmo";
    public static String str_1400_var_spanish = "Desarmar";
    public static String str_1400_var_portuguese = "Desacionar";
    public static String str_1400_var_arabic = "تعطيل";
    public static String str_3400_var = "全局布防";
    public static String str_3400_var_en = "Arm";
    public static String str_3400_var_german = "Globale Scharfschaltung";
    public static String str_3400_var_russian = "Общее вооружение";
    public static String str_3400_var_french = "Armement global";
    public static String str_3400_var_italian = "Armamento globale";
    public static String str_3400_var_spanish = "Armado global";
    public static String str_3400_var_portuguese = "Accionamento global";
    public static String str_3400_var_arabic = "تنشيط عالمي";
    public static String str_1301_var = "市电掉电";
    public static String str_1301_var_en = "AC power outaged";
    public static String str_1301_var_german = "AC-Strom ausgefallen";
    public static String str_1301_var_russian = "Отключено питание переменного тока";
    public static String str_1301_var_french = "Coupure de l'alimentation AC";
    public static String str_1301_var_italian = "Mancanza di corrente AC";
    public static String str_1301_var_spanish = "Corte de energía de CA";
    public static String str_1301_var_portuguese = "Energia AC fora de serviço";
    public static String str_1301_var_arabic = "انقطاع التيار الكهربي";
    public static String str_3301_var = "市电恢复";
    public static String str_3301_var_en = "AC power restored";
    public static String str_3301_var_german = "AC-Strom wiederhergestellt";
    public static String str_3301_var_russian = "Питание переменного тока восстановлено ";
    public static String str_3301_var_french = "Restauration  de l'alimentation AC ";
    public static String str_3301_var_italian = "Ripristino di corrente AC";
    public static String str_3301_var_spanish = "Energía CA restaurada";
    public static String str_3301_var_portuguese = "Energia AC restaurada";
    public static String str_3301_var_arabic = "استعادة التيار الكهربي";

    public static String str_1302_var = "备用电池低电";
    public static String str_1302_var_en = "Backup battery is low";
    public static String str_1302_var_german = "Backup-Batterie ist schwach";
    public static String str_1302_var_russian = "Низкий заряд батареи";
    public static String str_1302_var_french = "La batterie de secours est faible";
    public static String str_1302_var_italian = "La batteria di backup è scarica";
    public static String str_1302_var_spanish = "Batería de respaldo baja";
    public static String str_1302_var_portuguese = "Bateria de reserva está fraca";
    public static String str_1302_var_arabic = "البطارية الاحتياطية منخفضة";
    public static String str_3302_var = "备用电池恢复";
    public static String str_3302_var_en = "Backup battery is restored";
    public static String str_3302_var_german = "Backup-Batterie wiederhergestellt";
    public static String str_3302_var_russian = "Заряд батареи восстановлен";
    public static String str_3302_var_french = "La batterie de secours est restaurée";
    public static String str_3302_var_italian = "La batteria di backup è ripristinata";
    public static String str_3302_var_spanish = "Restaurada la la batería de respaldo";
    public static String str_3302_var_portuguese = "Bateria de reserva restaurada";
    public static String str_3302_var_arabic = "استعادة البطارية الاحتياطية";
    public static String str_1756 = "物联卡";
    public static String str_3756 = "非物联卡";
    public static String str_1393_var = "失联发生";
    public static String str_3393_var = "失联恢复";

    public static HuaweiApp huawei_app;
    public static SendNotifyMessage push_huawei_obj = new SendNotifyMessage();

    public static void database_to_map() {
        SpringJdbcTemplate springJdbcTemplate = new SpringJdbcTemplate();
        List<Machine> list = springJdbcTemplate.machine_list_query2();
        if (!((list == null) || list.isEmpty())) {
            for (int i = 0;i < list.size();i++) {
                String str_machine_name = list.get(i).getMachine_name();
                int id = list.get(i).getId();
//                logger.info("id=" + id);
//                logger.info("machine_name=" + str_machine_name);
                static_var.map_machine.put(str_machine_name,id);

                List<Token> list2 = springJdbcTemplate.token_list_query_for_machine_id(id);
                if (!((list2 == null) || list2.isEmpty())) {
                    for (int ii = 0;ii < list2.size();ii++) {
//                logger.info("token_name=" + list2.get(ii).getToken_name());
                        static_var.map_token.put(str_machine_name,list2);
                    }
                }

            }
        }


//        logger.info("static_var.map_machine=" + static_var.map_machine);
//        logger.info("static_var.map_token=" + static_var.map_token);
//        logger.info("static_var.map_machine.size=" + static_var.map_machine.size());
//        logger.info("static_var.map_token.size=" + static_var.map_token.size());
    }

    public static void push_msg_for_machine_name(String str_event_Q,String str_event_code_three,String str_machine,String str_number,String str_data_pure) {

        List<Token> list_token = static_var.map_token.get(str_machine);
        if (!((list_token == null) || list_token.isEmpty())) {
//            logger.info("list_token=" + list_token);
//            logger.info("list_token.size=" + list_token.size());
            for (int i = 0;i < list_token.size();i++) {
                String str_token = list_token.get(i).getToken_name();
                String str_language = list_token.get(i).getLanguage();
                String str_brand = list_token.get(i).getBrand();
                Integer length_token = list_token.get(i).getLength_token();
                String str_event_chinese_or_english = Cmd_fun
                        .event_cid_tostring_event_code_chinese_or_english(str_event_Q,str_event_code_three,str_language);
                if (str_event_chinese_or_english.equals("") || str_event_chinese_or_english.length() <= 0) {
//                    logger.info("error,no this event,str_event_chinese_or_english=" + str_event_chinese_or_english);
                    return;
                }

                try {
//                    logger.info("str_brand=" + str_brand);
//                    logger.info("data_samsung222=" + "[" + str_machine + ":" + str_data_pure);


                    if (str_brand.contains("samsung")) {
                        try {
                            logger.info("data_samsung=" + "[" + str_machine + ":" + str_data_pure);
                            Messaging.send_message_fcm_to_regid_language(str_token, str_event_chinese_or_english,
                                    "[" + str_machine + ":" + str_data_pure, str_machine, str_data_pure,str_language);
                        } catch (Exception e) {
                            logger.info("push_msg_for_machine_name,error=", e);
                            e.printStackTrace();
                        }
                    }
                    /*MyComp.mo.excutVoidTask_data_push4(str_event_Q,str_event_code_three,str_machine,
                            str_number,str_data_pure,str_event_chinese_or_english,str_brand,str_token,length_token);*/
                } catch (Exception e) {
                    logger.info("error=" + e);
                    e.printStackTrace();
                }

            }
        }
        else{
//            logger.info("error,str_machine=“ +　str_machine　”， is not exist" );
        }
    }
    public static void push_msg_for_machine_name2(String str_event_Q,String str_event_code_three,String str_machine,String str_number,String str_data_pure) {

        List<Token> list_token = static_var.map_token.get(str_machine);
        if (!((list_token == null) || list_token.isEmpty())) {
//            logger.info("list_token=" + list_token);
//            logger.info("list_token.size=" + list_token.size());
            for (int i = 0;i < list_token.size();i++) {
                String str_token = list_token.get(i).getToken_name();
                String str_language = list_token.get(i).getLanguage();
                String str_brand = list_token.get(i).getBrand();
                Integer length_token = list_token.get(i).getLength_token();
                Integer receipt = list_token.get(i).getReceipt();

                /*logger.info("str_token=" + str_token);
                logger.info("str_language=" + str_language);*/
                String str_event_chinese_or_english = Cmd_fun
                        .event_cid_tostring_event_code_chinese_or_english(str_event_Q,str_event_code_three,str_language);
//                logger.info("str_event_chinese_or_english=" + str_event_chinese_or_english);
                if (str_event_chinese_or_english.equals("") || str_event_chinese_or_english.length() <= 0) {
//                    logger.info("error,no this event,str_event_chinese_or_english=" + str_event_chinese_or_english);
                    return;
                }
                String str_content = "[" + str_machine + ":" + str_data_pure;
//                logger.info("str_content=" + str_content);
//                logger.info("str_brand=" + str_brand);
                if (str_brand.contains("Xiaomi")) {
                    str_token = str_token.substring(0,64);
//                    logger.info("str_token_xiaomi=" + str_token);
                    try {
                        xiaomi_push.sendMessageToAlias3(str_token,str_event_chinese_or_english,str_machine,str_number,str_data_pure);
//                        String alias2 = "1JC/eDRYxjPSYfI0l3heX8GhoBMcfGar8QXzEt6H0pqP6TX9ujw8WigknprWj+ZN";
//                        xiaomi_push.sendMessageToAlias2(alias2);
                    } catch (Exception e) {
                        logger.info("push_msg_for_machine_name,error=",e);
                        e.printStackTrace();
                    }
                }else if(str_brand.contains("HONOR")){//HONOR
                    /*if (str_token.substring(32).equals("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")) {
                        str_token = str_token.substring(0,32);
                    }else if (str_token.substring(114).equals("0000000000000000")) {
                        str_token = str_token.substring(0,114);
                        logger.info("str_token_honor115=" + str_token);
                    }

                    logger.info("str_token_honor=" + str_token);*/
//                    logger.info("length_token=" + length_token);
                    str_token = str_token.substring(0,length_token);
//                    logger.info("str_token_honor=" + str_token);


//                    PushNcMsg.sendPushMessage(str_token,str_alarm_event,str_machine,str_number,str_data_pure);
                    try {
                        static_var.push_huawei_obj.huawei_initialize_app();
                        static_var.push_huawei_obj.sendNotification2(str_token,str_event_chinese_or_english,"[" + str_machine + ":" + str_data_pure,str_machine,str_data_pure);
                    } catch (Exception e) {
                        logger.info("push_msg_for_machine_name,error=",e);
                        e.printStackTrace();
                    }


                }else if (str_brand.contains("Vivo")) {

//                    logger.info("str_content_vivo=" + "#" + str_machine + ":" + str_data_pure.substring(0,str_data_pure.length() - 1) + str_event_chinese_or_english);
                    str_token = str_token.substring(0,23);
//                    logger.info("str_token_vivo=" + str_token);
                    try {
                        vivo_push.send_message_vivo_to_regid_offiial_edition(str_token,str_event_chinese_or_english,
                                "#" + str_machine + ":" + str_data_pure.substring(0,str_data_pure.length() - 1) + str_event_chinese_or_english,str_machine,str_data_pure);
                    } catch (Exception e) {
                        logger.info("push_msg_for_machine_name,error=",e);
                        e.printStackTrace();
                    }
                }else if (str_brand.contains("OPPO")) {
                    str_token = str_token.substring(0,35);
//                    logger.info("str_token_oppo=" + str_token);
                    try {
                        String regId = "CN_a813bde520a0cf430007a023f4850e0f";
                        oppo_push.send_message_oppo_to_regid(str_token,str_event_chinese_or_english,
                                "[" + str_machine + ":" + str_data_pure,str_machine,str_data_pure);
                    } catch (Exception e) {
                        logger.info("push_msg_for_machine_name,error=",e);
                        e.printStackTrace();
                    }
                }else if (str_brand.contains("samsung")) {
                    try {
                        Messaging.send_message_fcm_to_regid(str_token,str_event_chinese_or_english,
                                "[" + str_machine + ":" + str_data_pure,str_machine,str_data_pure);
                    } catch (Exception e) {
                        logger.info("push_msg_for_machine_name,error=",e);
                        e.printStackTrace();
                    }
                }



            }
        }
        else{
            logger.info("error,str_machine=“ +　str_machine　”， is not exist" );
        }
    }

    public static void write_data_into_map(String machine_name,String language,String brand,String str_token,Integer length_token,Integer receipt) {
        boolean bflag = static_var.map_token.containsKey(machine_name);
        if (bflag) {

            List<Token> list_token = static_var.map_token.get(machine_name);
//            logger.info("original,list_token=" + list_token);
//            logger.info("original,list_token_size=" + list_token.size());

            boolean b_has_token = false;
            for (int i = 0;i < list_token.size();i++) {
                String str_token_temp = list_token.get(i).getToken_name();
//                logger.info("str_token=" + str_token);
                if (str_token.equals(str_token_temp)) {
                    b_has_token = true;
//                    logger.info("the token is exist,str_token=" + str_token);
//                    list_token.remove(i);
                    return;
                }
            }


            Token token = new Token();
            token.setToken_name(str_token);
            token.setLanguage(language);
            token.setBrand(brand);
            token.setLength_token(length_token);
            token.setReceipt(receipt);
            java.util.Date date = new java.util.Date();          // 获取一个Date对象
            Timestamp timeStamp = new Timestamp(date.getTime());
            token.setCreate_time(timeStamp.toString());
            list_token.add(token);
//            logger.info("now,list_token=" + list_token);
            static_var.map_token.put(machine_name,list_token);
//            logger.info("static_var.map_token=" + static_var.map_token);
//            static_var.map_token.put(machine_name,list_token);
        }else{
            List<Token> list_token = new ArrayList<>();
//            logger.info("original,list_token=" + list_token);
            Token token = new Token();
            token.setToken_name(str_token);
            token.setLanguage(language);
            token.setBrand(brand);
            token.setLength_token(length_token);
            token.setReceipt(receipt);
            java.util.Date date = new java.util.Date();          // 获取一个Date对象
            Timestamp timeStamp = new Timestamp(date.getTime());
            token.setCreate_time(timeStamp.toString());
            list_token.add(token);
//            logger.info("now,list_token=" + list_token);
            static_var.map_token.put(machine_name,list_token);
//            logger.info("static_var.map_token=" + static_var.map_token);
        }




    }



    public static void insert_alarm_event_into_map_history(String machine_name,String str_alarm_event,String str_time) {
        boolean bflag = static_var.map_history.containsKey(machine_name);
        if (bflag) {

            List<History> list_history = static_var.map_history.get(machine_name);
//            logger.info("insert_alarm_event_into_map_history,list_history=" + list_history);




            boolean b_has_token = false;
            for (int i = 0;i < list_history.size();i++) {
                String str_alarm_event_temp = list_history.get(i).getHistory_alarm_event();
                String str_time_temp = list_history.get(i).getHistory_create_time();

//                logger.info("str_alarm_event=" + str_alarm_event);
                if (str_alarm_event.equals(str_alarm_event_temp) && str_time_temp.equals(str_time)) {
                    b_has_token = true;
//                    logger.info("insert_alarm_event_into_map_history,the str_alarm_event is exist,str_alarm_event=" + str_alarm_event);
                    return;
                }
            }


            History history = new History();
            history.setHistory_alarm_event(str_alarm_event);
            history.setHistory_create_time(str_time);


            list_history.add(history);
//            logger.info("now,list_history=" + list_history);
            static_var.map_history.put(machine_name,list_history);
//            logger.info("static_var.map_history=" + static_var.map_history);
//            logger.info("static_var.map_history.size=" + static_var.map_history.size());



            if (list_history.size() > 20) {
                list_history.remove(0);
            }

        }else{
            List<History> list_history = new ArrayList<>();
//            logger.info("insert_alarm_event_into_map_history,list_history=" + list_history);

            History history = new History();
            history.setHistory_alarm_event(str_alarm_event);
            history.setHistory_create_time(str_time);

            list_history.add(history);
//            logger.info("insert_alarm_event_into_map_history,list_history=" + list_history);
            static_var.map_history.put(machine_name,list_history);
//            logger.info("insert_alarm_event_into_map_history,static_var.map_history=" + static_var.map_history);
//            logger.info("static_var.map_history.size=" + static_var.map_history.size());
        }




    }

    public static void get_alarm_event_from_map_history(String machine_name,String [] str_history_alarm_events,Integer[] nums_event) {
        String str_history_alarm_events_temp = "";
        Integer nums_record = 0;
        boolean bflag = static_var.map_history.containsKey(machine_name);
        if (bflag) {
            List<History> list_history = static_var.map_history.get(machine_name);
            if ((list_history.size() > 0) && (list_history.size() <= 20)) {
                for (int i = 0;i < list_history.size();i++) {
                    String str_alarm_event_temp = list_history.get(i).getHistory_alarm_event();
                    String str_time_temp = list_history.get(i).getHistory_create_time();
                    str_history_alarm_events_temp = str_history_alarm_events_temp + str_alarm_event_temp + str_time_temp;
                }
                str_history_alarm_events[0] = str_history_alarm_events_temp;
                nums_record = list_history.size();
                nums_event[0] = nums_record;
            }
            nums_event[0] = nums_record;
        }
        nums_event[0] = nums_record;
    }

    public static void remove_token_according_to_machine_name(String machine_name,String str_token) {
        boolean bflag = static_var.map_token.containsKey(machine_name);
        if (bflag) {
            List<Token> list_token = static_var.map_token.get(machine_name);
//            logger.info("original,list_token=" + list_token);
//            logger.info("original,list_token_size=" + list_token.size());
            for (int i = 0;i < list_token.size();i++) {
                String str_token_temp = list_token.get(i).getToken_name();
//                logger.info("str_token=" + str_token);
                if (str_token.equals(str_token_temp)) {
//                    logger.info("remove_token_according_to_machine_name,the token is exist,str_token=" + str_token);
                    list_token.remove(i);
                    i--;
                    //break;
                }
            }
        }
    }


    static public String get_controller_source(String str_controller_source){
        String str_value_returnString = "";
        int i_controller_source = Integer.valueOf(str_controller_source);
        if((i_controller_source >= 1) && (i_controller_source <= 97)){
//            str_value_returnString = "Remote Control" + ":" + str_controller_source.substring(2,3);
            str_value_returnString = "Key Fob" + ":" + str_controller_source.substring(2,3);
        }else if((i_controller_source >= 100) && (i_controller_source <= 199)){
            str_value_returnString =str_controller_source.substring(1, 3);
//			str_value_returnString = "APP:" + static_var.str_last_two_numbers + str_controller_source.substring(1, 3);
//			str_value_returnString = "APP:" + static_var.str_last_two_numbers + static_var.phone_acct_static_username;
//			str_value_returnString = "APP";
        }else{
            str_value_returnString = "Hub";
        }
        return str_value_returnString;
    }
}
